// Problem: P3368 【模板】树状数组 2
// Contest: Luogu
// URL: https://www.luogu.com.cn/problem/P3368
// Memory Limit: 125 MB
// Time Limit: 1000 ms
// DateTime : 2024-11-20 12:05:13
// Author : sunyafei
//
// Powered by CP Editor (https://cpeditor.org)

#include <bits/stdc++.h>
using namespace std;

#define int long long

class BIT{
private:
	vector<int> diff;
public:
	BIT(int n){
		diff.resize(n);
	}

	inline int lowbit(int x){
		return x&-x;
	}

	void add(int i,int x){
		while(i<diff.size()){
			diff[i]+=x;
			i+=lowbit(i);
		}
	}

	int query(int i){
		int res=0;
		while(i>0){
			res+=diff[i];
			i-=lowbit(i);
		}
		return res;
	}
};

void solve(){
	int n,m;cin>>n>>m;
	vector<int> a(n);
	for(int&x:a)cin>>x;
	BIT t(n+2);
	while(m--){
		int op;cin>>op;
		if(op==1){
			int l,r,x;cin>>l>>r>>x;
			t.add(l,x);
			t.add(r+1,-x);
		}else{
			int x;cin>>x;
			cout<<t.query(x)+a[x-1]<<"\n";
		}
	}
}

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int t=1;
	//cin>>t;
	while(t--){
		solve();
		cout<<"\n";
	}

	return 0;
}